-- CALC_SUMMON_MAX_HP

-- 计算召唤兽最大血量
-- @param summon    召唤兽
return function(summon)
    local max_hp = summon:query("max_hp") or 0;
    local classId = summon.class_id;
    local prop = {};

    -- TODO: 玩家对召唤兽属性加成%
    local addon = FormulaM.invoke("SUMMON_ATTRIB_ADDITION", summon, max_hp, "hp");

    -- 生命值+N
    prop = PropM.combine(summon, "attrib2", "hp");
    max_hp = PropM.apply(prop, max_hp);

    -- 根据楼层生命值+
    prop = PropM.combine(summon, "attrib_by_floor", "max_hp");
    if prop[3] > 0 then
        max_hp = PropM.trigger(summon, prop[1], prop[2], max_hp);
    end

    -- 所有召唤物能力加
    prop = PropM.combine(ME.user, "summon_attrib", "hp");
    max_hp = PropM.apply(prop, max_hp);

    -- TODO: 玩家的亡灵骨铠有加成
    if SummonM.query(classId, "dbase")["equipment_add"] == 1 then
        prop = PropM.combine(ME.user, "aid_attrib2", "hp");
        max_hp = PropM.apply(prop, max_hp);
    end

    return max_hp + addon;
end
